{extend name="layout" /}
{block name="head"}
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
{/block}
{block name="content"}
<div class="table-margin">
    <table class="table table-bordered table-header" id="list-table">
        <thead>
        <tr>
            <td>标题图片</td>
            <td>标题</td>
            <td>来源</td>
            <td>是否置顶</td>
            <td>发布时间</td>
            <td class="w20">操作</td>
        </tr>
        </thead>
        <tbody>
        {foreach name="list" item="vo"}
            <tr>
                <td><img height="50px;" src="__UPLOAD__{$vo['logo']}"></td>
                <td>{$vo['title']}</td>
                <td>{$vo['source']}</td>
                <td>{$vo['status']==1?'是':'否'}</td>
                <td>{$vo['create_time']}</td>
                <td>{$vo['operate']}</td>
            </tr>
        {/foreach}
        </tbody>
        <tfoot>
        <tr>
            <td colspan="10">
                <div class="pull-right">
                    <nav>
                        <ul class="pagination">{$list->render()}</ul>
                    </nav>
                </div>
            </td>
        </tr>
        </tfoot>
    </table>
</div>
<script type="text/javascript">
    function topping(id){
        layer.confirm('确定要置顶该资讯吗?', {icon: 3, title:'提示'}, function(index){
            $.getJSON("{:url('notice/top')}", {'id' : id}, function(res){
                if(1 == res.code){
                    layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                        location.reload(true);
                    });
                }else{
                    layer.alert(res.msg, {title: '友情提示', icon: 2});
                }
            });
            layer.close(index);
        })
    }
    function deleteNotice(id){
        layer.confirm('确认删除此资讯吗?', {icon: 3, title:'提示'}, function(index){
            $.getJSON("{:url('notice/delete')}", {'id' : id}, function(res){
                if(1 == res.code){
                    layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                        window.location.reload();
                    });
                }else{
                    layer.alert(res.msg, {title: '友情提示', icon: 2});
                }
            });
            layer.close(index);
        })
    }
</script>
{/block}
